// 歌单列表页面头部组件
<template>
    <div class="listviewTop">
        <!-- 背景照片 -->
        <img class="bg" :src="playlist.coverImgUrl">
        <!-- 头部 -->
        <div class="listviewNav">
            <!-- 返回上层 -->
            <div class="back" @click="$router.go(-1)">
                <span class="iconfont icon-zuojiantou"></span>
                <span class="title">歌单</span>
            </div>
            <!-- 右侧搜索和更多 -->
            <div class="search">
                <span class="iconfont icon-sousuo"></span>
                <span class="iconfont icon-gengduo"></span>
            </div>
        </div>
        <!-- 图片标题作者 -->
        <div class="content">
            <div class="contentLeft">
                <img :src="playlist.coverImgUrl" alt="">
                <span class="iconfont icon-bofang">{{changeValue(playlist.playCount)}}</span>
            </div>
            <div class="contentRight">
                <h3>{{playlist.name}}</h3>
                <div class="auther" v-if="playlist.creator">
                    <img :src="playlist.creator.avatarUrl" alt="">
                    <span>{{playlist.creator.nickname}}</span>
                </div>
                <div class="description">
                    <span>{{playlist.description}}</span>
                </div>
            </div>
        </div>
        <!-- 四个按钮 -->
        <div class="iconList">
            <div class="iconItem">
                <span class="iconfont icon-xinxi"></span>
                <span>{{playlist.commentCount}}</span>
            </div>
            <div class="iconItem">
                <span class="iconfont icon-fenxiang"></span>
                <span>{{playlist.shareCount}}</span>
            </div>
            <div class="iconItem">
                <span class="iconfont icon-xiazai"></span>
                <span>下载</span>
            </div>
            <div class="iconItem">
                <span class="iconfont icon-show_duoxuan"></span>
                <span>多选</span>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    // 接受父组件传来的参数
    props:['playlist'],
    methods: {
        // 过滤播放次数，万为单位
        changeValue(num) {
            var res=0;
            if(num>=10000){
                res = num/10000
                res = res.toFixed(2) + "万"
            }
            return res
        }
    },
    
}
</script>

<style lang="less" scoped>
    .listviewTop{
        width: 7.5rem;
        padding: 0 0.4rem;
        .bg{
            position: fixed;
            top: 0;
            left: 0;
            width: 7.5rem;
            height: auto;
            z-index: -1;
            filter: blur(40px)
        }
        .listviewNav{
            display: flex;
            justify-content: space-between;
            height: 1.2rem;
            line-height: 1.2rem;
            align-items: center;
            font-size: 0.4rem;
            color: #fff;
            margin: 10px 0;
            .back,.search{
                display: flex;
                .title{
                    margin-left: 0.4rem;
                }
                .icon-sousuo{
                    margin-right: 0.4rem;
                }
            }
            .iconfont{
                font-size: 0.6rem;
            }
        }
        .content{
            padding: 0.4rem 0;
            display: flex;
            justify-content: space-between;
            .contentLeft{
                position: relative;
                img{
                    width: 3rem;
                    height: 3rem;
                    border-radius: 0.1rem;
                }
                span{
                    position: absolute;
                    right: 0.1rem;
                    top: 0.2rem;
                    font-size: 0.2rem;
                    color: #ccc;
                }
            }
            .contentRight{
                display: flex;
                flex-direction: column;
                padding-left: 0.2rem;
                justify-content: space-around;
                h3{
                    color: #eee;

                }
                .auther{
                    display: flex;
                    img{
                        widows: 0.6rem;
                        height: 0.6rem;
                        border-radius: 50%;
                    }
                    span{
                        color: rgb(236, 221, 221);
                        line-height: 0.6rem;
                        margin-left: 0.2rem;
                    }
                }
                .description{
                    // 文字只显示两行,其他隐藏,显示...
                    span{
                        align-items: center;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        display: -webkit-box;
                        -webkit-line-clamp: 2;
                        -webkit-box-orient: vertical;
                        display: -moz-box;
                        -moz-line-clamp: 2;
                        -moz-box-orient: vertical;
                        word-wrap: break-word;
                        word-break: break-all;
                        white-space: normal; 
                    }
                    
                }
            }
        }
        // 四个图标
        .iconList{
            display: flex;
            justify-content: space-around;
            text-align: center;
            color: #eee;
            margin-bottom: 0.4rem;
            .iconItem{
                .iconfont{
                    font-size: 0.5rem;
                    margin-bottom: 0.1rem;
                }
                display: flex;
                flex-direction: column;
            }
        }
    };
    
</style>